﻿using System;
using Microsoft.Xna.Framework;
using XNAFight.Players;
using XNAFight.Engine.Inputs;

namespace XNAFight.Scene.Core
{
    public abstract class Battlefield : Screen
    {
        #region CHAMPS

        private Player player_one, player_two;
        private Decor decor;

        #endregion

        #region PROPRIETES
        
        public Player PlayerOne
        {
            get { return player_one; }
            set { player_one = value; }
        }
        public Player PlayerTwo
        {
            get { return player_two; }
            set { player_two = value; }
        }
        public int HauteurSol
        {
            get { return decor.HauteurSol; }
            set 
            {
                decor.HauteurSol = value;
                player_one.Personnage.HauteurSol = value;
                player_two.Personnage.HauteurSol = value;
            }
        }

        #endregion

        public Battlefield(int _hauteur_sol, string _nom_perso_p_one, string _nom_perso_p_two, Controler _controler_p_one, Controler _controler_p_two, InGameInputConfiguration _inputConf_p_one, InGameInputConfiguration _inputConf_p_two)
            : base()
        {
            decor = new Decor();

            player_one = new Player(CommonContent.CurrentGame.Content, _nom_perso_p_one, _controler_p_one, _inputConf_p_one, new Vector2(200, _hauteur_sol));
            player_two = new Player(CommonContent.CurrentGame.Content, _nom_perso_p_two, _controler_p_two, _inputConf_p_two, new Vector2(600, _hauteur_sol));
            HauteurSol = _hauteur_sol;

        }

        public override void Update(GameTime _game_time)
        {
            base.Update(_game_time);

            PlayerOne.Update(_game_time, player_two.Personnage);
            PlayerTwo.Update(_game_time, player_one.Personnage);

        }
    }
}
